package top.mschen.blog.common.exception;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.springframework.core.NestedRuntimeException;

/**
 * StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); stackTrace = sw.toString();
 */
public class NestedException extends NestedRuntimeException {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3344811353365228405L;

	public NestedException(String msg) {
		super(msg);
	}

	public NestedException(String msg, Throwable cause) {
		super(msg, cause);
	}

	public NestedException(Throwable cause) {
		super("-----", cause);
	}

	public String getStackTraceMessage() {
		StringWriter writer = new StringWriter();
		this.printStackTrace(new PrintWriter(writer));
		return writer.toString();
	}

}